<?php

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

<title>AllyFolio | Home </title>



    
	<div id="main_wrapper">

    <!--=================Header Start=======================-->

	<?php include_once "includes/header.php"; ?>

    <!--=================Header end=======================-->

    

    

<script type="text/javascript">
    $(function() { $('input, textarea').placeholder();});
</script>

<style type="text/css">
    .chat_box{
        display:none;
    }
    .placeholder {
      color: #cccccc;
      }
/* emotions */
#emotionsdrp{
    position: absolute;
    padding: 4px;
}

#emotionsdrp div .em{
    cursor: pointer;
    padding: 2px;
} 
#emotionsdrp{
    background-color: gainsboro;
    width: 130px;
}
.em{
    
}
.em:hover{
    background-color: cadetblue;
    cursor:pointer;
}
</style>



<style type="text/css">

	.logo{ margin-top:10px;}

	.log_button{

	

	height:auto;

	margin:6px 0;

	overflow:hidden;

	float:left;

	margin-top:10px;

	

	}

	.new tr td{ vertical-align:top}

	

	textarea select{ border:1px solid #ccc}

	input textarea select{ border:1px solid #999}

    

    /* added by sujeet */

    .privacy-drp-menu{

        border:1px solid blue;

        display: none;

    }

    .privacy-drp-menu-items{

        border-bottom: 1px solid gray;

        cursor:pointer;

    }

    .comment{

        width: 84%;

        height: 25px;

        padding-left: 4px;

        padding-right: 4px;

        border:none; 

        background:none;

    }   

    .listenMe{

        width: 100%;

        text-align: center;

        padding-top: 14px;

        padding-bottom: 14px;

    }

    .feed{

        margin-top: 20px;

    }
    .para{
        line-height: 1.75 !important;
    }
    .countUpdates {
        /* background: #000; */
        padding: 1px;
        color: #000;
        /* border-radius: 5px; */
        padding: 0 5px;
    }
    .linktxt{
        color:blue;
    }
    .linktxt:hover{
        color:blue;
        text-decoration: underline;
    }
    
    /* notification popup */
                    #nav{list-style:none;margin: 0px;padding: 0px;}
                    #nav li {
                    float: left;
                    margin-right: 20px;
                    font-size: 14px;
                    font-weight:bold;
                    }
                    #nav li a{color:#333333;text-decoration:none}
                    #nav li a:hover{color:#006699;text-decoration:none}
    /*notification div */
    #notification_li
{
position:relative
}
#notificationContainer 
{
background-color: #fff;
border: 1px solid rgba(100, 100, 100, .4);
-webkit-box-shadow: 0 3px 8px rgba(0, 0, 0, .25);
overflow: visible;
position: absolute;
top: 30px;
margin-left: -170px;
width: 400px;
z-index: 10;
display: none; // Enable this after jquery implementation 
}
// Popup Arrow
#notificationContainer:before {
content: '';
display: block;
position: absolute;
width: 0;
height: 0;
color: transparent;
border: 10px solid black;
border-color: transparent transparent white;
margin-top: -20px;
margin-left: 188px;
}
#notificationTitle
{
font-weight: bold;
padding: 8px;
font-size: 13px;
background-color: #ffffff;
/*position: fixed;*/
z-index: 1000;
width: 384px;
border-bottom: 1px solid #dddddd;
}
#notificationsBody
{
/*padding: 33px 0px 0px 0px !important;*/
height:300px;
overflow-x: auto;
}
#notificationFooter
{
background-color: #e9eaed;
text-align: center;
font-weight: bold;
padding: 8px;
font-size: 12px;
border-top: 1px solid #dddddd;
}

/* notification count*/
#notification_count 
{
padding: 3px 7px 3px 7px;
background: #cc0000;
color: #ffffff;
font-weight: bold;
margin-left: -10px;
border-radius: 9px;
-moz-border-radius: 9px;
-webkit-border-radius: 9px;
position: absolute;
margin-top: -11px;
font-size: 11px;
}

.notify{
    padding:10px;
}
</style>

<link href="css/emoticons.css" rel="stylesheet" type="text/css"/>

<!-- custom post submission jquery by sujeet -->
<?php include_once("smiley.php");?>
<script type="text/javascript" src="js/smiley.js"></script>
<script src="js/autoloading.js"></script>
<script src="js/custom_popupshow.js"></script>
<script src="js/jquery.asyncpost.js"></script>
<script type="text/javascript" src="js/jwplayer.js"></script>
</head>



<body style="background-color: #E8F6F6;">

<?php
try{
    $loggedUserObj=new UserDetails();
    if (!isset($_SESSION["User_details"])){
        $_SESSION["User_details"]=$loggedUserObj->getUserDetails($_SESSION["Allyfolio_User_ID"],true);
    }
    $loggedUserObj=$_SESSION["User_details"];
    $loggedUserObj->latestFriendNotificationsArr=array(1=>"sumer",2=>"vikas");
}
catch(Exception $ex){
    $logObj->writeException("home.php Exception: => ".$ex->getMessage());
    die("Home.php fetching user details".$ex->getMessage());
}
//data from user config

$userSettings=array(
                'emailid'=>$loggedUserObj->emailId,
                'id'=>$_SESSION["Allyfolio_User_ID"],
                'privacy_settings'=>$loggedUserObj->feedsetting
                );                

$_SESSION['user_settings']=$userSettings;
$mineuid=$loggedUserObj->userId;
$myLastNotificationID=0;
include_once("updates/ReadNotifications.php");

$qryUserData="select * from af_users where af_users.User_ID='".$_SESSION["Allyfolio_User_ID"]."' ";
$arrUserData=array();
$arrUserData=$pdodbobj->fetch_array($pdodbobj->query($qryUserData,array()));
?>

<div class="home_right">

		<table width="100%" border="0">

			<tr>

				<td>
                    <table width="100%">
                        <tr>
                            <td width="120px">&nbsp;</td>
                            <td width="520px">
                                <div id="stupdthandler"></div>
                                <div id="light_stupdtsec">
                    <form id="frmstupdt" name="frmstupdt" action="ajax/update_data.php?action=st_update" enctype="multipart/form-data" > 

					<div class="status">

						<div class="status_top1">

                            <?php

                            $oDropfilters= new CGetFilters();

                            $privacyTypes=$oDropfilters->getFilters("privacy_types");

                            //print_r($privacyTypes);

                            ?>

                            <div id="statusshare">

                                <input type="text" id="ajx_status_update" name="ajx_status_update" placeholder="Status Update/Write what you think.." />

                                <div id="status_tagging" style="display: none;">

                                    <div style="border-top: dashed 1px gray;">

                                        <input type="text" id="st_taggedusers" name="st_taggedusers" placeholder="Enter friends name.." />

                                        <input type="hidden" id="sttaggedusers" name="sttaggedusers" />

                                    </div>

                                    

                                </div>
                                
                                <div id="status_emotions" style="display: none;">
                                    <div style="border-top: dashed 1px gray;">
                                    <!--
                                        <div id="st_emotionsfeeling_txt" style="display: none;">
                                            <input type="text" id="st_emotionsfeeling" name="st_emotionsfeeling" placeholder="what you do.." onclick="return openEmotionCategoriesList();"/>
                                        </div>
                                        -->
                                        <div id="st_emotionsfeeling_div" onclick="return openEmotionCategoriesList();" style="height:25px"></div>
                                        <input type="hidden" id="stemotionsfeeling" name="stemotionsfeeling" />
                                    </div>
                                    <div id="emotionslist" style="width: 150px;position: absolute;display:none"></div>
                                    

                                </div>
                                <span id="post_location" style="padding: 5px;"></span>

                            </div>

							

								<div class="stat_bot">
                                    <div id="image_loader_div" style="display:none;"><img src="images/LoadingBar.gif" width="64px" height="64px"/></div>

                                    <div id="post_media_thumb_div">

                                        

                                    </div>

                                    <br />

									<ul>

										<li >

                                            <select id="prvset" id="prvset" onchange="setPrivacySetting(this.value)" class="blueuicontrol">

                                                <?php

                                                 $myprivacysetting=0;

                                                if (!empty($_SESSION['user_settings']['privacy_settings'])) {

                                                    $myprivacysetting = trim($_SESSION['user_settings']['privacy_settings']);

                                                }

                                                if(is_numeric($myprivacysetting) && $myprivacysetting>0){

                                                    $defaultSelected=$myprivacysetting;

                                                }

                                                else{

                                                    $defaultSelected=1; //privacy type assigned    

                                                }

                                                foreach($privacyTypes as $privacyType){

                                                    if($privacyType["ID"]==$defaultSelected){

                                                        $selected=true;

                                                    }

                                                    else if($privacyType["keyword"]=="public"){

                                                        $selected=true;

                                                    }

                                                    else{

                                                        $selected=false;

                                                    }

                                                        

                                                        

                                                    ?>

                                                    <option value="<?php echo $privacyType["ID"] ?>" <?php if($selected){  ?>selected="true" <?php } ?> >

                                                        <?php echo $privacyType["Privacy_Type_Title"]; ?> 

                                                    </option>

                                                    <?php

                                                }

                                                ?>

                                            </select>
                                            <div id="st_myclusters" style="display:none">
                                                <select id="st_share_with_cluster" name="st_share_with_cluster" class="blueuicontrol">                                                    
                                                </select>
                                            </div>
        
        
                                        </li>

										<li>

											<a href="javascript:void(0)" onclick="return openFile('status_update_file')"><img src="images/ico/5.png" /></a>

											<div id="image_loader_div" style="display:none;"><img src="images/LoadingBar.gif" width="64px" height="64px"/></div>

											<input type="file" id="status_update_file" name="status_update_file" style="display:none;" accept="audio/*,video/*,image/*" onchange="return uploadMedia('1','status_update_file','frmstupdt','post_media_thumb_div','status_file_hidden');" />

											<input type="hidden" name="status_file_hidden" id="status_file_hidden" value="" />

											<!-- 1 for status Update -->

										</li>

										<li>

											<a href="javascript:void(0)" onclick="return openFile('status_update_file')"><img src="images/ico/6.png" /></a>

										</li>

										<li>
                                            <a href="javascript:void(0)" onclick="return showEmotionsBox();">
                                                <img src="images/ico/7.png" />
                                            </a>
                                        </li>

										<li>

                                            <a href="javascript:void(0)" onclick="showMyLocationBox();" title="Add Location">
                                                <!-- showAddLocationBox() -->
                                                <img src="images/ico/8.png" />

                                            </a>

                                        </li>

										<li>

                                            <a href="javascript:void(0)" onclick="showStatusTaggedBox();" title="Add Location">

                                                <img src="images/ico/9.png" />

                                            </a>

                                        </li>

										<li style="float:right;">

                                            <a href="add_blog.php">

                                                <!--<span style="padding-right:5px;">Create Blog</span>-->    
                                                <input type="button" class="blueuicontrol" style="width:100px!important" value="Create Blog" />
                                            </a>

											<input type="button" id="#post_s" class="blueuicontrol" style="width:80px!important;cursor: pointer;" onclick="updateStatus('frmstupdt');" value="send" />

											<!--

	                                        <span id="#post_s" onclick="updateStatus('frmstupdt');">send</span>

	                                        -->

                                        </li>

									</ul>

									<div class="clearfix"></div>

                                    <input type="hidden" id="locstr" name="locstr" value="NONE" />

							</div>

						</div>

					</div>

                    <div id="errconsole"></div>

                    </form>
                    
                    <div id="light_mylocation" style="display:none">
                        <iframe src="mylocation.php" width="500px" height="250px"></iframe>
            <!--<input type="text" id="txtlocationtemp1" name="txtlocationtemp1" style="width: 400px;height:25px"/>
            <input type="submit" value="Finish" />
            <div id="somecomponent1" style="width: 400px; height: 200px;"></div>
            <script>
            //ref: http://logicify.github.io/jquery-locationpicker-plugin/
            //https://codeload.github.com/Logicify/jquery-locationpicker-plugin/zip/master
                $('#somecomponent1').locationpicker({
                    location: {latitude: 46.15242437752303, longitude: 2.7470703125},	
                    radius: 200,
                    inputBinding: {
                        //latitudeInput: $('#us2-lat'),
                        //longitudeInput: $('#us2-lon'),
                        //radiusInput: $('#us2-radius'),
                        locationNameInput: $('#txtlocationtemp1')
                    },
                    enableAutocomplete: true,
                    onchanged: function(currentLocation, radius, isMarkerDropped) {
                       //alert("Location changed. New location (" + currentLocation.latitude + ", " + currentLocation.longitude + ")"+ currentLocation);
                    }
                });
                $("#light_mylocation").css("display","none");
                   
            </script>
            -->
        </div>  
                </div>        
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                    </table> 
                    
                    
				</td>

				<td></td>

			</tr>

		</table>

        

        <style>

        #tweets { border-left:1px solid gray; padding-left:20px}

        #overlay { position: absolute; left: 168px; top: 87px;

           width: 408px; height:386px; background: url("../images/transpBlue_overlay.png"); }

        #overlay img { position:relative; left:200px; top:189px; }   

        </style>

        
              
        
                    
                
        <!-- js scrolling -->

        <div id="tweets">

           <!-- Tweets will get loaded from jQuery -->

        </div>

        <div id="viewmore" style="background-color:gray; width:84%;pointer:cursor">

            <div style="text-align: center;padding-top: 10px;padding-bottom: 10px;pointer:cursor" onclick="return OnViewMore('<?php echo $loggedUserObj->userId; ?>','<?php echo $loggedUserObj->feedsetting; ?>',false,postTypeToRead.feeds);">

                View More >>

            </div>

           <!-- Tweets will get loaded from jQuery -->

        </div>

        <!--<div id="overlay">

           <img src="images/ajax-loader.gif" />

        </div>-->

        <!-- js scrolling -->

        

        <script type="text/javascript">

            $('#ajx_status_update').keypress(function (e) {

              if (e.which == 13) {

                ust("frmstupdt");    

                //$('form#frmstupdt').submit();

                return false;    //<---- Add this line

              }

            });

            // Set the size for each page to load

            requserid='<?php echo $loggedUserObj->userId; ?>';

            requserprivacysetting='<?php echo $loggedUserObj->feedsetting; ?>';

            

            var pageSize = 15;              

            // Username to load the timeline from

            var username = 'marcofolio';             

            // Variable for the current page

            var currentPage = 1;            

            // Loads the next tweets

            var loadTweets = function(lsttweet) {

               //getNewsFeeds('<?php echo $loggedUserObj->userId; ?>','0','<?php echo $loggedUserObj->feedsetting; ?>');

               OnViewMore('<?php echo $loggedUserObj->userId; ?>','<?php echo $loggedUserObj->feedsetting; ?>',true,postTypeToRead.feeds,0);

            };

            

            // First time, directly load the tweets

            loadTweets(0);

            /*

            // Append a scroll event handler to the container

            $(document).scroll(function() {

               // We check if we're at the bottom of the scrollcontainer

               var windowScrollHeight=parseInt($(window).scrollTop() + $(window).height());

               

               if(windowScrollHeight == $(document).height()) {

                   //alert("bottom!");

                   // getData();

               }

               else{

                    if(windowScrollHeight>(parseInt($(document).height())-300) ) {

                        //find last feed id read

                        var lastTweetRead= $("#tweets .feed:last-child").find(".lstfeedtime").val();

                        loadTweets(lastTweetRead);

                        currentPage++;

                        $("#overlay").fadeIn();

                    }

               }

               

               //if ($(this)[0].scrollHeight - $(this).scrollTop() == $(this).outerHeight()) {             

//                  // If we're at the bottom, show the overlay and retrieve the next page

//                  currentPage++;

//                  $("#overlay").fadeIn();

//                  loadTweets();

//               }

            });

            */      

        </script>

        

        

        

		</div>

    

    

    <div class="clearfix"></div>

    <?php include_once "common_divs_include.php"; ?>

    

</div>

    <!--=================Footer end=======================-->

    <script type="text/javascript">

    	function uploadProfilePic()

    	{

			if(document.getElementById("profile_pic_file").value!="")

			{

				document.getElementById("profile_image_loader_div").style.display="";

				formdata = false;

				if (window.FormData) {

					formdata = new FormData(document.getElementById("profile_pic_form"));

				}

			

				var xmlhttp;

						

				if (window.XMLHttpRequest)

				{// code for IE7+, Firefox, Chrome, Opera, Safari

					xmlhttp=new XMLHttpRequest();

				}

				else

				{// code for IE6, IE5

					xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

				}

				xmlhttp.onreadystatechange=function()

				{

					if (xmlhttp.readyState==4 && xmlhttp.status==200)

					{	

						var res=xmlhttp.responseText;	

						resArr=res.split("|~|");

						var divContent="";

						if(resArr[0]=="SUCCESS")

						{

							

							document.getElementById("profile_pic_img").src='uploads/image_crop.php?image=/'+resArr[1]+'&width=57&height=52&cropratio=57:52';

							document.getElementById("profile_image_loader_div").style.display="none";

						}

						else

						{

							document.getElementById("profile_image_loader_div").style.display="none";

							alertify.alert(resArr[1]);

						}

					}

				}	

				xmlhttp.open("POST","ajax_upload_profile_pic.php",true);

				xmlhttp.send(formdata);

			}

		}

    	function uploadMedia(postType,fileControlId,formName,containerDiv,hiddenField)

		{

			if(document.getElementById(fileControlId).value!="")

			{

				document.getElementById("image_loader_div").style.display="";

				formdata = false;

				if (window.FormData) {

					formdata = new FormData(document.getElementById(formName));

				}

			

				var xmlhttp;

						

				if (window.XMLHttpRequest)

				{// code for IE7+, Firefox, Chrome, Opera, Safari

					xmlhttp=new XMLHttpRequest();

				}

				else

				{// code for IE6, IE5

					xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

				}

				xmlhttp.onreadystatechange=function()

				{

					if (xmlhttp.readyState==4 && xmlhttp.status==200)

					{	

						var res=xmlhttp.responseText;	

						resArr=res.split("|~|");

						var divContent="";

						if(resArr[0]=="SUCCESS")

						{

							////document.getElementById("blog_display_img").src="uploads/temp_blog_images/"+resArr[1];

//							//document.getElementById("blog_image").src="uploads/image_crop.php?image=/uploads/blog_images/"+resArr[1]+"&width=982&height=571&cropratio=982:571";

//							var divContent='<div class="upVid">';

//							divContent +='<div class="vid"><a href="'+resArr[1]+'" class="PagePhotoGallery" data-fancybox-group="PagePhotoGallery"><img src="uploads/image_crop.php?image=/'+resArr[1]+'&width=93&height=91&cropratio=93:91" /></a></div>';

//							divContent +='</div>';

//							

//							document.getElementById("page_photos_div").innerHTML=document.getElementById("page_photos_div").innerHTML+divContent;

							

							divContent +='<div class="post_media_thumb" data-image="'+resArr[1]+'">';

							var extArr=["vob","mp4","3gp","mp3"];

							var pathArr=resArr[1].split(".");

							if(jQuery.inArray( (pathArr[pathArr.length-1]), extArr )>=0)

							{

								divContent +='<img src="uploads/image_crop.php?image=/images/dummy_video.jpg&width=40&height=40&cropratio=40:40"/>';

							}

							else

							{

								divContent +='<img src="uploads/image_crop.php?image=/'+resArr[1]+'&width=40&height=40&cropratio=40:40"/>';

							}

							divContent +='<a href="javascript:void(0)" onclick="return deleteMedia(\''+resArr[1]+'\',\''+hiddenField+'\');">X</a>';

							divContent +='</div>';

							

							document.getElementById(containerDiv).innerHTML=document.getElementById(containerDiv).innerHTML+divContent;

							document.getElementById(hiddenField).value=document.getElementById(hiddenField).value+resArr[1]+",";

							document.getElementById("image_loader_div").style.display="none";

						}

						else

						{

							document.getElementById("image_loader_div").style.display="none";

							alertify.alert(resArr[1]);

						}

					}

				}	

				xmlhttp.open("POST","ajax/upload_media.php",true);

				xmlhttp.send(formdata);

			}

		}

		

		function deleteMedia(mediaPath,hiddenField)

		{

			$("div").find("[data-image='" + mediaPath + "']").remove(); //find data-image

			var updatedMedias=$("#"+hiddenField).val().replace(mediaPath, " ");

			var mediaArr=updatedMedias.split(",");

			var currentMedias="";

			for(i=0;i<mediaArr.length;i++)

			{

				if(mediaArr[i].trim()!="")

				{

					currentMedias=currentMedias+mediaArr[i]+","

				}

			}

			document.getElementById(hiddenField).value=currentMedias;

		}

		

		function openFile(fileControlId)

		{

			$("#"+fileControlId).trigger("click");

		}

    

        function showHideChatBuddies(){

            var buddyListDisplay= $(".cc2").css("display");

            if(buddyListDisplay!="none"){

                $(".cc2").css("display","none");

            }

            else{

                $(".cc2").css("display","block");

            }

        }

    </script>

    <script>

        $( "#frmstupdt" ).submit(function( event ) {

          // Stop form from submitting normally

          event.preventDefault();

          // Get some values from elements on the page:

          ust("frmstupdt");
        });

        function updateStatus(){

            ust("frmstupdt");

        }

        function showEmotionsBox(){     
            
            if($("#status_emotions")){
                if($("#status_emotions").css("display")=="none"){
                    $("#status_emotions").show();
                    $("#emotionslist").hide();
                }
                else{
                    $("#status_emotions").hide();
                }
            }
            
            
        }
        function openEmotionCategoriesList(){
            if($("#emotionslist")){
                if($("#emotionslist").css("display")=="none"){
                    getEmotionsDropdown();
                    $("#emotionslist").show();
                }
                else{
                    $("#emotionslist").hide();
                }
            }
        }
    </script>

<!-- <script type="text/javascript" src="js/jquery.min.1.9.js"></script> -->
<script type="text/javascript" >
$(document).ready(function()
{
    
$("#notificationLink").click(function()
{
$("#notificationContainer").fadeToggle(300);
$("#notification_count").fadeOut("slow");
return false;
});

//Document Click hiding the popup 
$(document).click(function()
{
$("#notificationContainer").hide();
});

//Popup on click
$("#notificationContainer").click(function()
{
return false;
});

});

//getBirthdayNotifications('<?php echo $_SESSION['Allyfolio_User_ID']; ?>');
</script>
</html>